import time
def bubl(mas):
    N = len(mas)
    for i in range(N):
        for j in range(N - i - 1):
            if mas[j] > mas[j + 1]:
                mas[j], mas[j + 1] = mas[j + 1], mas[j]
def red(nam):
    file = open(nam, 'r')
    dat = file.readlines()
    return dat
m1 = red("m1_sorted.txt")
m2 = red("m2_reverse.txt")
m3 = red("m3_shuffle.txt")
t1 = time.time()
m4 = bubl(m1)
t2 = time.time()
print("m1_sorted", round((t2 - t1) * 1000), "milliseconds")
t3 = time.time()
m5 = bubl(m2)
t4 = time.time()
print("m2_reverse", round((t4 - t3) * 1000), "milliseconds")
t5 = time.time()
m6 = bubl(m3)
t6 = time.time()
print("m3_shuffle", round((t6 - t5) * 1000), "milliseconds")
